package com.sikaryofficial.backend.config;

import cn.hutool.core.collection.CollUtil;
import com.sikaryofficial.backend.domain.vo.UpgradeVO;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

import java.util.List;
import java.util.Map;

/**
 * @author : wuweihong
 * @desc : 指引任务相关配置
 * @date : 2024-12-09
 */

@Getter
@Setter
@Configuration
@RefreshScope
@ConfigurationProperties(prefix = "hismk.backend.guide")
@Slf4j
public class GuideTaskConfig {

	private List<Map<String, Integer>> taskList;

	public Integer getPointsByTaskCode(String taskCode) {
		Integer points = 0;
		if (CollUtil.isEmpty(taskList)) {
			return points;
		}
		for (Map<String, Integer> mapping : taskList) {
			if (mapping.containsKey(taskCode)) {
				points = mapping.getOrDefault(taskCode, 0);
				break;
			}
		}
		return points;
	}

	/**
	 * 系统更新通知
	 */
	private List<UpgradeVO> systemUpdateNotices;
}
